1 //------------------------------------------------------------------------
3 // Copyright (c) Microsoft Corporation. All rights reserved.
6 // Implements the minimal set of interfaces required for
7 // the version-independent hosting shim.
10 // 2005/05/09 - [....]
13 // Ported Windows->DevDiv. See SourcesHistory.txt.
15 //------------------------------------------------------------------------
19 BOOL
ShouldProcessBeRestricted(void);
20 BOOL
LaunchRestrictedProcess(__in LPCWSTR lpwszCmdLine
, __in_ecount(dwDisabledPrivilegeCount
) PLUID_AND_ATTRIBUTES pDisabledPrivileges
, DWORD dwDisabledPrivilegeCount
);
21 BOOL
IsCurrentProcessRestricted(__in_ecount(dwDisabledPrivilegesCount
) PLUID_AND_ATTRIBUTES ppDisabledPrivileges
, DWORD dwDisabledPrivilegesCount
);
23 const WELL_KNOWN_SID_TYPE g_disableSIDS
[] = { WinBuiltinAdministratorsSid
,
24 WinBuiltinPowerUsersSid
};
26 const LPCWSTR g_ppwszPrivileges
[18] = { SE_ASSIGNPRIMARYTOKEN_NAME
,
28 SE_CREATE_GLOBAL_NAME
,
29 SE_CREATE_PERMANENT_NAME
,
31 SE_ENABLE_DELEGATION_NAME
,
33 SE_MACHINE_ACCOUNT_NAME
,
34 SE_REMOTE_SHUTDOWN_NAME
,
38 SE_TAKE_OWNERSHIP_NAME
,
43 SE_CREATE_PAGEFILE_NAME
46 BOOL
IsCurrentPresentationHostRestricted(__in PSID_AND_ATTRIBUTES pDisabledSids
,
47 __in DWORD dwDisabledSidCount
,
48 __in PLUID_AND_ATTRIBUTES pDisabledPrivileges
,
49 __in DWORD dwDisabledPrivilegeCount
);
51 DWORD
CreateRestrictedProcess(__in PSID_AND_ATTRIBUTES pDisabledSids
,
52 __in DWORD dwDisabledSidCount
,
53 __in PLUID_AND_ATTRIBUTES pDisabledPrivileges
,
54 __in DWORD dwDisabledPrivilegeCount
,
55 __in LPCWSTR lpwszCmdLine
);
57 // Call FreeSIDArray() when done with the returned data.
58 DWORD
GetDisabledSids(__out PSID_AND_ATTRIBUTES
*ppDisabledSids
,
59 __out DWORD
*pdwDisabledSidCount
);
62 DWORD
GetDisabledPrivileges(__out PLUID_AND_ATTRIBUTES
*ppDisabledPrivileges
,
63 __out DWORD
*pdwDisabledPrivlegeCount
);
65 DWORD
GetSid(__in WELL_KNOWN_SID_TYPE sidType
,
67 __inout DWORD
*pdwSidSize
);
69 DWORD
GetUserSid(__in HANDLE hProcToken
,
70 __out_bcount(SECURITY_MAX_SID_SIZE
) PSID pSid
);
72 BOOL
CheckForDisabledSids(__in PSID_AND_ATTRIBUTES pSids
,
73 __in DWORD dwSidCount
,
74 __in PSID_AND_ATTRIBUTES pDisabledSids
,
75 __in DWORD dwDisabledSidCount
);
77 BOOL
CheckForRestrictedSids(__in PSID_AND_ATTRIBUTES pSids
,
78 __in DWORD dwSidCount
,
79 __in PSID_AND_ATTRIBUTES pRestrictedSids
,
80 __in DWORD dwRestrictedSidCount
,
83 BOOL
CheckForPrivileges(__in PLUID_AND_ATTRIBUTES pPrivileges
,
84 __in DWORD dwPrivilegeCount
,
85 __in PLUID_AND_ATTRIBUTES pDisabledPrivileges
,
86 __in DWORD dwDisabledPrivilegeCount
);
88 DWORD
AddSidsToToken(__in HANDLE hRestrictedToken
,
93 BOOL
SetSidsOnAcl(__in PSID
*ppSids
,
96 __out PACL
*pAclDestination
,
98 __in DWORD AccessMask
,
103 void GetAndPrintTokenInfo(__in
FILE *fLog
, __in HANDLE hToken
);
104 void GetAndPrintTokenDefaultDacl(__in
FILE *fLog
, __in HANDLE hToken
);
106 void PrintTokenInfo(__in
FILE *fLog
, __in PTOKEN_GROUPS_AND_PRIVILEGES pTokenGroups
);
107 void PrintDACL(__in
FILE *fLog
, __in PACL pAcl
);
108 void PrintSid(__in
FILE *fLog
, __in PSID pSid
, __in LPCWSTR lpwszData
, __in DWORD dwIndex
);
109 void PrintPrivileges(__in
FILE *fLog
, __in PLUID_AND_ATTRIBUTES pTokenPrivileges
, __in DWORD dwPrivilegeCount
);
114 DWORD
CreateRestrictedProcess(__in PSID_AND_ATTRIBUTES pDisabledSids
,
115 __in DWORD dwDisabledSidCount
,
116 __in PLUID_AND_ATTRIBUTES pDisabledPrivileges
,
117 __in DWORD dwDisabledPrivilegeCount
,
118 __in LPCWSTR lpwszCmdLine
);
120 BOOL
IsPresentationHostHighIntegrity();